<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<base href="<%=basePath%>">

<html>
    
    <head>
        <meta charset="utf-8">
        <title>
            阳光成单系统
        </title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="System/css/x-admin.css" media="all">
    </head>
    
    <body>
        <div class="x-body">
            <form class="layui-form layui-form-pane">
                <div class="layui-form-item">
                    <label for="L_title" class="layui-form-label">
                        公告编号
                    </label>
                    <div class="layui-input-block">
                        <input value="${announcement.announcementId}" type="text" id="L_title" name="announcementId" required lay-verify="announcementId"
                               autocomplete="off" class="layui-input" readonly="readonly">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_title" class="layui-form-label">
                        公告内容
                    </label>
                    <div class="layui-input-block">
                        <input value="${announcement.announcementContent}" type="text" id="announcementContent" name="announcementContent" required lay-verify="announcementContent"
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_title" class="layui-form-label">
                        公告标题
                    </label>
                    <div class="layui-input-block">
                        <input value="${announcement.announcementTitle}" type="text" id="announcementTitle" name="announcementTitle" required lay-verify="announcementTitle"
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item" style="display:none;">
                    <label for="L_title" class="layui-form-label">
                        发布时间
                    </label>
                    <div class="layui-input-block">
                        <input type="text" id="announcementTime" name="announcementTime" required lay-verify="announcementTime"
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_title" class="layui-form-label">
                        发布人
                    </label>
                    <div class="layui-input-block">
                        <input value="${announcement.employees.employeesName}" type="text" id="employees" name="employees" required lay-verify="employees"
                               autocomplete="off" class="layui-input" readonly="readonly">
                    </div>
                </div>
                <div class="layui-form-item" style="display:none;">
                    <label for="L_title" class="layui-form-label">
                        状态
                    </label>
                    <div class="layui-input-block">
                        <input type="text" id="announcementCode" name="announcementCode" required lay-verify="announcementCode"
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <button type="submit" class="layui-btn" lay-filter="update" lay-submit>
                        点击修改
                    </button>
                </div>
            </form>
        </div>
        <script src="System/lib/layui/layui.js" charset="utf-8">
        </script>
        <script src="System/js/x-layui.js" charset="utf-8">
        </script>
        <script>
            layui.use(['form','layer','upload'], function(){
                $ = layui.jquery;
              var form = layui.form()
              ,layer = layui.layer;

              //监听提交
              form.on('submit(update)', function(data){
                  var announcementId=data.field.announcementId;//公告编号
                  var announcementTitle=data.field.announcementTitle;//公告标题
                  var announcementContent=data.field.announcementContent;//公告内容
                  location.href="announcement/updateAnnouncementById?announcementId="+announcementId+"&announcementTitle="+announcementTitle+"&announcementContent="+announcementContent;
                  //发异步，把数据提交给
                console.log(data.field.announcementId);
                  console.log(data.field.announcementTitle);
                  console.log(data.field.announcementContent);
                  // 获得frame索引
                  var index = parent.layer.getFrameIndex(window.name);
                  parent.layer.close(index);//关闭当前页
                  layer.msg('添加成功!',{time:1000});
                return false;
              });
              
              
            });
        </script>
        
    </body>

</html>